package com.juzi.javabean;

import java.util.Scanner;

/**
    目标：记住JavaBean的书写要求
 */
public class Test {
    public static void main(String[] args) {
        //1、无参构造器创建对象封装一个用户信息
        User u1 = new User();
        Scanner sc = new Scanner(System.in);

        System.out.println("请输入名称");
        String name = sc.next();
        u1.setName(name);

        System.out.println("请输入身高");
        Double height = sc.nextDouble();
        u1.setHeight(height);


        System.out.println("请输入工资");
        Double salary = sc.nextDouble();
        u1.setSalary(salary);

        System.out.println(u1.getName());
        System.out.println(u1.getHeight());
        System.out.println(u1.getSalary());

        //2、有参数构造器创建对象封装一个用户信息
        System.out.println("请输入用户信息");

        System.out.println("请输入名称");
        String name1 = sc.next();
        System.out.println("请输入身高");
        Double height1 = sc.nextDouble();
        System.out.println("请输入工资");
        Double salary1 = sc.nextDouble();

        User u2 = new User(name1,height1,salary1);
        System.out.println(u2.getName());
        System.out.println(u2.getHeight());
        System.out.println(u2.getSalary());
    }
}
